package com.itheima.BigDecimal;

import java.math.BigDecimal;
import java.util.Scanner;

public class BigDecimaDemo {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入第一个数:");
        String a = sc.next();
        BigDecimal bd1 = new BigDecimal(a);
        System.out.println("请输入第二个数");
        String b = sc.next();
        BigDecimal bd2 = new BigDecimal(b);
        System.out.println("请输入运算选择:1加;2减;3乘;4除");
        String c = sc.next();
        switch (c){
            case"1":
                System.out.println(a+"+"+b+"="+(bd2.add(bd1)));
                break;
            case"2":
                System.out.println(a+"+"+b+"="+(bd2.subtract(bd1)));
                break;
            case"3":
                System.out.println(a+"+"+b+"="+(bd2.multiply(bd1)));
                break;
            case"4":
                System.out.println(a+"+"+b+"="+(bd2.divide(bd1)));
                break;
        }
    }
}
